import { _decorator, Component, Node, Label, clamp01 } from 'cc';
import { BasicUI } from '../../Init/Basic/BasicUI';
import { GlobalConfig } from '../../Init/Config/GlobalConfig';
import { GlobalTmpData } from '../../Init/Config/GlobalTmpData';
import EventManager from '../../Init/Managers/EventManager';
import { EventTypes } from '../../Init/Managers/EventTypes';
import { AudioEnum } from '../../Init/SystemAudio/AudioEnum';
import { AudioSystem } from '../../Init/SystemAudio/AudioSystem';
import { SDKSystem, PlatformType } from '../../Init/SystemSDK/SDKSystem';
import { StorageSystem } from '../../Init/SystemStorage/StorageSystem';
import { UIEnum } from '../../Init/SystemUI/UIEnum';
import { UISystem } from '../../Init/SystemUI/UISystem';
import { MoveVideoCmp } from '../WinUI/MoveVideoCmp';
const { ccclass, property } = _decorator;

@ccclass('LoseUI')
export class LoseUI extends BasicUI {

    @property(Label)
    protected awardLabel: Label = null;
    protected awardNum = 0;

    public show(d) {
        super.show(d);
        UISystem.hideUI(UIEnum.LevelInfoUI);
        UISystem.showUI(UIEnum.PlayerAssetsUI);
        AudioSystem.playEffect(AudioEnum.Lose);

        if (this.shareBtn) {
            this.shareBtn.active = SDKSystem._curPlatform == PlatformType.TTMiniGame;
        }

        this.showAd();

    }

    // #region --------按钮----------

    //关闭 
    protected onCloseClick() {
        UISystem.hideUI(UIEnum.LoseUI);
        //重新开始 /返回首页           
        this.emit(EventTypes.GameEvents.SetLevelManagerEnable, false);
        UISystem.showUI(UIEnum.HomeUI);
        UISystem.hideUI(UIEnum.LevelPanelUI);
    }

    @property(Node)
    shareBtn: Node = null;
    //分享
    protected onShareClick() {
        EventManager.emit(EventTypes.SDKEvents.ShareRecord, () => {
            this.shareBtn.active = false;
        });
    }

    //#endregion

    // #region --------广告----------
    private showAd() {

    }

    //#endregion
}

